package com.flurry.android;

import android.content.Context;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.AbsoluteLayout;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

final class ex extends fm
{
  private static final Map<Class<? extends ViewGroup>, cd> gC = Collections.unmodifiableMap(localHashMap);
  private static final String p = ex.class.getSimpleName();
  private final p gD;

  static
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put(LinearLayout.class, new bw());
    localHashMap.put(AbsoluteLayout.class, new fq());
    localHashMap.put(FrameLayout.class, new eu());
    localHashMap.put(RelativeLayout.class, new x());
  }

  public ex(p paramp, AdUnit paramAdUnit)
  {
    super(paramAdUnit);
    this.gD = paramp;
  }

  public final void a(Context paramContext, ViewGroup paramViewGroup)
  {
    new StringBuilder().append("render(").append(paramContext).append(", ").append(paramViewGroup).append(")").toString();
    if ((this.gD == null) || (paramContext == null) || (paramViewGroup == null))
    {
      new StringBuilder().append("failed to render banner ad for bannerView = ").append(this.gD).append(" for context = ").append(paramContext).append(" for viewGroup = ").append(paramViewGroup).toString();
      return;
    }
    FlurryAds localFlurryAds = FlurryAds.getInstance();
    v localv = localFlurryAds.hn.a(localFlurryAds, paramContext, paramViewGroup, bs());
    if (localv == null)
    {
      new StringBuilder().append("failed to render banner ad for holder = ").append(localv).append(" for adSpaceName = ").append(bs()).toString();
      return;
    }
    ViewGroup localViewGroup1 = (ViewGroup)localv.getParent();
    if (localViewGroup1 != null)
      localViewGroup1.removeView(localv);
    localv.stop();
    localv.removeAllViews();
    ViewGroup localViewGroup2 = (ViewGroup)this.gD.getParent();
    if (localViewGroup2 != null)
      localViewGroup2.removeView(this.gD);
    localv.addView(this.gD, new RelativeLayout.LayoutParams(-1, -1));
    this.gD.initLayout(paramContext);
    ViewGroup.LayoutParams localLayoutParams;
    int i;
    int j;
    if ((L() == null) || (L().getAdFrames().size() < 1))
    {
      localLayoutParams = null;
      if (localLayoutParams != null)
      {
        localv.setLayoutParams(localLayoutParams);
        new StringBuilder().append("banner ad holder layout params = ").append(localLayoutParams.getClass().getName()).append(" {width = ").append(localLayoutParams.width).append(", height = ").append(localLayoutParams.height).append("} for banner ad with adSpaceName = ").append(bs()).toString();
      }
      i = paramViewGroup.getChildCount();
      if ((L() != null) && (L().getAdFrames().size() >= 1))
        break label512;
      j = i;
    }
    while (true)
    {
      paramViewGroup.addView(localv, j);
      return;
      AdSpaceLayout localAdSpaceLayout2 = ((AdFrame)L().getAdFrames().get(0)).getAdSpaceLayout();
      if (localAdSpaceLayout2 == null)
      {
        localLayoutParams = null;
        break;
      }
      cd localcd = (cd)gC.get(paramViewGroup.getClass());
      if (localcd == null)
      {
        new StringBuilder().append("Ad space layout and alignment from the server is being ignored for ViewGroup subclass ").append(paramViewGroup.getClass().getSimpleName()).toString();
        localLayoutParams = null;
        break;
      }
      localLayoutParams = localcd.a(paramContext, localAdSpaceLayout2);
      if (localLayoutParams != null)
        break;
      new StringBuilder().append("Ad space layout and alignment from the server is being ignored for ViewGroup subclass ").append(paramViewGroup.getClass().getSimpleName()).toString();
      break;
      label512: AdSpaceLayout localAdSpaceLayout1 = ((AdFrame)L().getAdFrames().get(0)).getAdSpaceLayout();
      if (localAdSpaceLayout1 != null)
      {
        String[] arrayOfString = localAdSpaceLayout1.getAlignment().toString().split("-");
        if ((arrayOfString.length == 2) && ("t".equals(arrayOfString[0])))
          j = 0;
      }
      else
      {
        j = i;
      }
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.ex
 * JD-Core Version:    0.6.2
 */